<template>
  <div>
    <div>
      <h3>拍卖合约-出价( 出价前请先去 账户管理-解锁账户取得私钥 )</h3>
      <el-input style="width: 800px" placeholder="请输入私钥" v-model="paiMaiBid.privateKey">
        <template slot="prepend">私钥：</template>
      </el-input><br><br>
      <el-input style="width: 800px" placeholder="请输入合约地址" v-model="paiMaiBid._contractAddress">
        <template slot="prepend">合约地址：</template>
      </el-input><br><br>
      <el-input style="width: 400px" placeholder="请输入出价金额" v-model="paiMaiBid.money">
        <template slot="prepend">出价金额：</template>
      </el-input>
      <el-input style="width: 400px" placeholder="请输入gasLimit，建议50万以上" v-model="paiMaiBid.gasLimit">
        <template slot="prepend">gasLimit：</template>
      </el-input>
      <br><br>
      <el-button type="primary" @click="sendPaiMaiBid">提交出价</el-button>
      <div>
        <el-descriptions column=1 title="出价结果">
          <el-descriptions-item label="message">{{paiMaiBidInfo.message}}</el-descriptions-item>
          <el-descriptions-item label="出价hash">{{paiMaiBidInfo.transactionHash}}</el-descriptions-item>
        </el-descriptions>
      </div>
    </div>
  </div>
</template>

<script>
import contractList from "./contractList";
export default {
  name: "invokingContract",
  components: {contractList},
  data() {
    return {
      paiMaiBid: {
        privateKey: '',
        _contractAddress: '',
        money: '',
        gasLimit: '',
      },
      paiMaiBidInfo: '',
    }
  },

  methods: {
    sendPaiMaiBid() {
      this.axios.post("/paiMaiBid", {
        privateKey: this.paiMaiBid.privateKey,
        _contractAddress: this.paiMaiBid._contractAddress,
        money: this.paiMaiBid.money,
        gasLimit: this.paiMaiBid.gasLimit,
      }).then(res => {
        if (res.data.code == 200) {
          this.paiMaiBidInfo = res.data;
        }else {
          alert(res.data.message);
        }
      })
    },
  },
}
</script>

<style scoped>

</style>
